{include file="public/header" /}

<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">时间范围</label>
                            <div class="layui-input-inline">
                                <input type="text" name="time" class="layui-input" id="test6" placeholder=" - ">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>

        <!--<div class="layui-card-body">-->
        <!--<div style="padding-bottom: 10px;">-->
        <!--<button class="layui-btn layuiadmin-btn-list" data-type="batchdel">删除</button>-->
        <!--<button class="layui-btn layuiadmin-btn-list" data-type="add">添加</button>-->
        <!--</div>-->
        <!--</div>-->
    </div>

    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <!--<div class="layui-card-header">放款统计</div>-->
                <div class="layui-card-body">
                    <table class="layui-hide" id="test-table-checkbox" lay-filter="test-table-checkbox"></table>

                    <!--<script type="text/html" id="store_pid">-->
                    <!--<img src="{{d.logo}}" style="display: inline-block; width: 100%; height: 100%;" alt="aaaaaaaaaa">-->
                    <!--</script>-->

                    <!--<script type="text/html" id="table-content-list">-->
                    <!--<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>-->
                    <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>-->
                    <!--</script>-->
                </div>
            </div>
        </div>
    </div>
</div>
</body>

{include file="public/footer" /}

<script>
    layui.use(['table','form','laydate'], function(){
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;

        //日期主题
        laydate.render({
            elem: '#test6'
            ,range: true
            ,theme: 'molv'
        });

        //监听搜索
        form.on('submit(LAY-user-back-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('test-table-checkbox', {
                where:{
                    'name':field.name,
                    'time':field.time,
                }
            });
        });

        //定义表格基础参数
        table.render({
            elem: '#test-table-checkbox',
            url: "{:url('admin/sum/loan')}",
            toolbar:true,
            defaultToolbar: ['filter', 'exports', 'print'],
            height: 'full-200',//最大高度
            cols: [[//标题栏

                {field: 'time', title: "<p style='text-align:center;'>日期</p>", width: 110,fixed: 'left'} //rowspan即纵向跨越的单元格数
                ,{field: 'zfNum', title: "<span lay-tips='今日总放款订单数'>总放款单数?</span>",fixed: 'left'}
                ,{field: 'zfMoney', title: "<span lay-tips='当日放款订单中的申请金额合计'>总放款金额?</span>"}

                ,{field: 'xkNum', title: "<span lay-tips='用户第一笔借款视为新客'>新客单数?</span>"}
                ,{field: 'lkNum', title: "<span lay-tips='用户在已有一笔已完成订单基数上后续订单均属于老客订单'>老客单数?</span>"}

                ,{field: 'xkLv', title: "<span lay-tips='新客放款率 = (新客单数/总放款单数)*100%'>新客放款率?</span>"}
                ,{field: 'lkLv', title: "<span lay-tips='老客单数 = (老客单数/总放款单数)*100%'>老客放款率?</span>"}
                // ,{field: 'xqNum', title: "<span lay-tips='???'><p style='color: red;'>续期单数?</p></span>", width: 110,}
            ]],
            page: true
        });

        //监听行事件
        table.on('row(test-table-checkbox)', function(obj){
            if(obj.data.ids){
                layer.open({
                    type: 2
                    ,title: ''
                    ,content: 'getOrderInfo?ids='+obj.data.ids+'&viewType=loan_order_info'
                    ,maxmin: true
                    ,area:['90%','80%']
                    ,shadeClose:true,
                });
            }else{
                layer.msg('未查到订单信息',{time:600});
            }
        });
    });
</script>
